package meituan;

import java.util.Scanner;

/**
 * @Author Stringzhua
 * @Date 2024/11/9 14:42
 * description:
 */
public class test01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        //统计人名的数量
        int count = 0;
        //计数器
        int i = 0;
        while (i < s.length()) {
            if (Character.isUpperCase(s.charAt(i))) {
                //如果是大写字母
                count++;
                while (i < s.length() && s.charAt(i) != ' ') {
                    i++;
                }
            } else {
                i++;
            }
        }
        System.out.println(count);
        sc.close();
    }
}
